﻿using System.Collections.Generic;
using Common;

namespace IBiz
{
    public abstract class Ecmd
    {
        protected string Ip;
        protected string Port;
        protected int RelayIndex;

        protected Dictionary<int, string> DicSetOnCmd = new Dictionary<int, string>();
        protected Dictionary<int, string> DicSetOffCmd = new Dictionary<int, string>();
        protected Dictionary<int, string> DicGetCmd = new Dictionary<int, string>();

        protected Ecmd()
        {
            Ip = SystemConfig.RelayIP;
            Port = SystemConfig.RelayPort;
            DicSetOnCmd.Add(SystemConstant.EcmdPinMode, SystemConstant.EcmdPinSetOn);
            DicSetOnCmd.Add(SystemConstant.EcmdI2CMode, SystemConstant.EcmdI2CSetOn);

            DicSetOffCmd.Add(SystemConstant.EcmdPinMode, SystemConstant.EcmdPinSetOff);
            DicSetOffCmd.Add(SystemConstant.EcmdI2CMode, SystemConstant.EcmdI2CSetOff);

            DicGetCmd.Add(SystemConstant.EcmdPinMode, SystemConstant.EcmdPinGet);
            DicGetCmd.Add(SystemConstant.EcmdI2CMode, SystemConstant.EcmdI2CGet);
        }

        public abstract string GetValue();
        public abstract void Open();
        public abstract void Close();
    }
}
